<!--
*
* Copyright 2015 HISP Tanzania
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* @since 2015
* @author Joseph Chingalo profschingalo@gmail.com>
*
*
-->
<div padding-top>
  <div style="display: inline-block;width: 49.3%">
    <span *ngIf="!hasEventDatesLabel(programStage.executionDateLabel)">{{ translationMapper['Report date'] }}</span>
    <span *ngIf="hasEventDatesLabel(programStage.executionDateLabel)">{{ programStage.executionDateLabel }}</span>
    <span class="required">*</span>
    <div class="input-field-container">
      <data-time-input [(inputValue)]="currentOpenEvent['eventDate']" (dateTimeUpdateAction)="updateEventDate($event,'eventDate')"
        [mode]="'date'"></data-time-input>
    </div>
  </div>
  <div style="display: inline-block;width: 49.3%" *ngIf="!programStage.hideDueDate">
    <span *ngIf="!hasEventDatesLabel(programStage.dueDateLabel)"> {{ translationMapper['Due date'] }}</span>
    <span *ngIf="hasEventDatesLabel(programStage.dueDateLabel)">{{ programStage.dueDateLabel }}</span>
    <div class="input-field-container">
      <data-time-input [withoutHorizontalPadding]="true" [(inputValue)]="currentOpenEvent['dueDate']"
        (dateTimeUpdateAction)="updateEventDate($event,'dueDate')" [mode]="'date'"></data-time-input>
    </div>
  </div>

  <div *ngIf="!(currentOpenEvent['eventDate'] && currentOpenEvent['eventDate'] !='')">
    <event-date-notification [notification]="getEventDateNotification()"></event-date-notification>
  </div>

</div>
<div *ngIf="currentOpenEvent['eventDate'] && currentOpenEvent['eventDate'] !=''">
  <div *ngIf="(programStage && programStage.id && programStage.programStageDataElements && programStage.programStageDataElements.length > 0)">
    <div *ngIf="!hiddenProgramStages[programStage.id]">
      <div *ngIf="programStage.captureCoordinates" class="item-card">
        {{ translationMapper['Coordinate']}}
        <event-coordinate-selector (onChangeEventCoordonate)="updateEventCoordonate($event)" [(coordinate)]="currentOpenEvent.coordinate"></event-coordinate-selector>
      </div>
      <div *ngIf="formLayout === 'customLayout' && programStage && programStage.dataEntryForm && programStage.dataEntryForm !== '' ">
        <custom-data-entry-form [entryFormType]="entryFormType" [dataEntryFormDesign]="programStage.dataEntryForm"
          [data]="dataObject" [dataUpdateStatus]="dataUpdateStatus" [programStageDataElements]="programStage.programStageDataElements"
          [programStageId]="programStage.id" (onCustomFormInputChange)="updateData($event)"></custom-data-entry-form>
      </div>
      <div *ngIf="!(formLayout === 'customLayout' && programStage && programStage.dataEntryForm && programStage.dataEntryForm !== '' )">
        <default-event-entry-form [(errorOrWarningMessage)]="errorOrWarningMessage" [(hiddenSections)]="hiddenSections"
          [(hiddenFields)]="hiddenFields" [programStage]="programStage" [currentUser]="currentUser" [(dataObject)]="dataObject"
          [(dataValuesSavingStatusClass)]="dataValuesSavingStatusClass" (onChange)="updateData($event)"></default-event-entry-form>
      </div>
    </div>
  </div>
  <div *ngIf="!(programStage && programStage.programStageDataElements && programStage.programStageDataElements.length > 0)">
    <div *ngIf="currentOpenEvent['eventDate'] && currentOpenEvent['eventDate'] !=''">
      <notification [message]="translationMapper['Contact your help desk to add data elements on this stage']"></notification>
    </div>
  </div>
</div>
